//
//  CRSessionMessageContentView.h
//  TestPrj
//
//  Created by 朱铅峰 on 2020/9/28.
//  Copyright © 2020 Xing. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "CRKitEvent.h"
#import "CRMessageModel.h"

typedef NS_ENUM (NSInteger, CRSessionMessageContentViewLayout){
    CRSessionMessageContentViewLayoutAuto = 0, //根据消息自动布局
    CRSessionMessageContentViewLayoutLeft,  //左边布局
    CRSessionMessageContentViewLayoutRight, //右边布局
};

@protocol CRMessageContentViewDelegate <NSObject>

- (void)onCatchEvent:(CRKitEvent *)event;

@end

@interface CRSessionMessageContentView : UIControl

@property (nonatomic,strong,readonly)  CRMessageModel   *model;

@property (nonatomic,strong) UIImageView * bubbleImageView;

@property (nonatomic,assign) CRSessionMessageContentViewLayout layoutStyle;

@property (nonatomic,weak) id<CRMessageContentViewDelegate> delegate;

/**
 *  contentView初始化方法
 *
 *  @return content实例
 */
- (instancetype)initSessionMessageContentView;

/**
 *  刷新方法
 *
 *  @param data 刷新数据
 *
 */
- (void)refresh:(CRMessageModel*)data;


/**
 *  手指从contentView内部抬起
 */
- (void)onTouchUpInside:(id)sender;


/**
 *  手指从contentView外部抬起
 */
- (void)onTouchUpOutside:(id)sender;

/**
 *  手指按下contentView
 */
- (void)onTouchDown:(id)sender;


/**
 *  聊天气泡图
 *
 *  @param state    目前的按压状态
 *  @param outgoing 是否是发出去的消息
 *
 */
- (UIImage *)chatBubbleImageForState:(UIControlState)state outgoing:(BOOL)outgoing;

@end

